#include <cstdio>
#include <cstring>
const int N = 15;
int n, cnt, a, b;
int f[N][10], s[N];
inline int abs(int x) { return x < 0 ? -x : x; }
int dfs(int x, int l, bool lim, bool sta) {
  if (!x) return sta;
  if (!lim && f[x][l] != -1) return f[x][l];
  int maxi = lim ? s[x] : 9, res = 0;
  for (int i = 0; i <= maxi; ++i) {
    res += dfs(x - 1, i, i == maxi, sta & (abs(l - i) >= 2));
  }
  if (!lim) f[x][l] = res;
  return res;
}

int solve(int x) {
  memset(f, -1, sizeof(f));
  // for (int i = 0; i < 10; ++i) f[0][i] = 1;
  cnt = 0;
  int res = 0;
  while (x) s[++cnt] = x % 10, x /= 10;
  for (int i = 1; i <= s[cnt]; ++i) {
    res += dfs(cnt - 1, i, i == s[cnt], true);
  }
  return res;
}
int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#endif
#ifndef LOCAL
  freopen("windy.in", "r", stdin);
  freopen("windy.out", "w", stdout);
#endif
#endif
  /* for (int i = 1; i < N; ++i) {
    for (int j = 0; j < 10; ++j) {
      for (int k = 0; k < 10; ++k) {
        f[i][j][k] += f[i - 1][]
      }
    }
  } */
  scanf("%d%d", &a, &b);
  printf("%d", solve(b) - solve(a - 1));
  return 0;
}